package com.aaa.mrcai.controller;

import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.SysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @Author:Li-Yan-Chun
 * @Date:2021/12/2 16:43
 */
@Controller
@RequestMapping("sys")
public class SysController {
    @Autowired
    private SysService sysService;


    @RequestMapping("login")
    @ResponseBody
    public AjaxResult login(String  adminname,String password){

        return sysService.login(adminname,password);
    }

    @RequestMapping("getInfo")
    @ResponseBody
    public AjaxResult getInfo(){
        return sysService.getInfo();
    }

    @RequestMapping("logout")
    public String logout(){
        sysService.logout();
        return "redirect:/index.html";
    }
}
